import utils from "../utils";

export default class StringTpl {
    private KEY_STR: string = "";
    private defaultVal: string = "";
    constructor(key: string, defaultVal: string = "") {
        this.KEY_STR = `PHQ_SYSTEM_${key}_STRINGTPL_STR`;
        this.defaultVal = defaultVal;
    }
    public Get(): any {
        const val = sessionStorage.getItem(this.KEY_STR) as string;
        return utils.empty(val) ? this.defaultVal : val;
    }
    public Set(val: any) {
        if (!utils.empty(val)) {
            sessionStorage.setItem(this.KEY_STR, val);
        }
    }
    public Remove() {
        sessionStorage.removeItem(this.KEY_STR);
    }
}
